package paas.storage.serviceTest;

import com.alibaba.fastjson.JSON;
import org.apache.derby.iapi.util.IdUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import paas.storage.distributedColumnDatabase.IConnection;
import paas.storage.result.CreateResponse;
import paas.storage.util.JSONHelper;

import java.util.Map;
import java.util.UUID;

/**
 * 连接测试类
 *
 * @author xufeng
 * @email 525207937@qq.com
 * @date 2021/1/26 13:53
 */
@Service
public class IConnectionTest {

    private static Logger log = LoggerFactory.getLogger(IConnectionTest.class);

    @Autowired
    private IConnection iConnection;
    /**
     * 创建连接
     */
    public void createConnection() {
        Map map = (Map) JSONHelper.ResolveJsonFileToObject("test.json");
        CreateResponse createResponse = iConnection.create(UUID.randomUUID().toString(), map.get("token").toString(), map.get("config").toString());
        log.info("返回连接{}", JSON.toJSONString(createResponse));
    }

}
